<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('实有单位基本信息列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>单位名称：</label>
                            <input type="text" name="dwmc-like"/>
                        </li>
                        <li>
                            <label>单位分类： </label><select name="gaglDwfl"
                                                         th:with="type=${@dict.getParamValue('SQJW_FWSSZT')}"
                                                         class="selectpicker">
                            <option value="">请选择</option>
                            <option th:each="dict : ${type}" th:text="${dict.itemText}"
                                    th:value="${dict.itemValue}"></option>
                        </select>
                        </li>
                        <li>
                            <label>经济类型： </label><select name="jjlxdm"
                                                         th:with="type=${@dict.getParamValue('SQJW_JJLX')}"
                                                         class="selectpicker">
                            <option value="">请选择</option>
                            <option th:each="dict : ${type}" th:text="${dict.itemText}"
                                    th:value="${dict.itemValue}"></option>
                        </select>
                        </li>
                        <li>
                            <label>场所分类： </label><select name="jxcsfl"
                                                         th:with="type=${@dict.getParamValue('SQJW_JXCSFL')}"
                                                         class="selectpicker">
                            <option value="">请选择</option>
                            <option th:each="dict : ${type}" th:text="${dict.itemText}"
                                    th:value="${dict.itemValue}"></option>
                        </select>
                        </li>
                        <li>
                            <label>是否重点： </label><select name="sfzd"
                                                         th:with="type=${@dict.getParamValue('SFZD_DQJC')}"
                                                         class="selectpicker">
                            <option value="">请选择</option>
                            <option th:each="dict : ${type}" th:text="${dict.itemText}"
                                    th:value="${dict.itemValue}"></option>
                        </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-default" onclick="getStaffList()">
                <i class="fa fa-reorder"></i> 从业人员
            </a>
            <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="control:unit:import">
                <i class="fa fa-upload"></i> 导入
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="control:unit:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('control:unit:edit')}]];
    var removeFlag = [[${@permission.hasPermi('control:unit:remove')}]];
    var prefix = ctx + "control/unit";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/deleteBatch",
            exportUrl: prefix + "/exportXls",
            importTemplateUrl: prefix + "/importTemplate",
            importUrl: prefix + "/importExcel",
            detailUrl: prefix + "/detail/{id}",
            modalName: "实有单位基本信息",
            columns: [{
                checkbox: true
            },
                {
                    field: 'zagldwbm',
                    title: '单位编码',
                    visible: false
                },
                {
                    field: 'dwmc',
                    title: '单位名称'
                },
                {
                    field: 'gaglDwfl_dictText',
                    title: '单位分类'
                },
                {
                    field: 'sjmc',
                    title: '实际名称'
                },
                {
                    field: 'jjlxdm_dictText',
                    title: '经济类型'
                },
                {
                    field: 'jyfwzy',
                    title: '主营'
                },
                {
                    field: 'dwdzQhnxxdz',
                    title: '单位地址'
                },
                {
                    field: 'jxcsfl_dictText',
                    title: '九小场所分类'
                },
                {
                    field: 'jyzt_dictText',
                    title: '经营状态'
                },
                {
                    field: 'ssjlxxqDzbm_dictText',
                    title: '所属街路'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        // actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="addStaff(\'' + row.zagldwbm + '\')"><i class="fa fa-plus"></i>从业人员</a> ');
                        actions.push("<a class='btn btn-warning btn-xs' href='javascript:void(0)' onclick=$.operate.detail('" + row.zagldwbm + "')><i class='fa fa-search'></i>详细</a> ");
                        actions.push('<a class="btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.zagldwbm + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.zagldwbm + '\')"><i class="fa fa-remove"></i>删除</a>');
                        /*var more = [];
                        more.push("<a class='btn btn-success btn-xs' href='javascript:void(0)' onclick=addStaff('" + row.zagldwbm + "')><i class='fa fa-plus'></i>从业人员</a> ");
                        more.push("<a class='btn btn-warning btn-xs' href='javascript:void(0)' onclick=$.operate.detail('" + row.zagldwbm + "')><i class='fa fa-search'></i>详细</a> ");
                        actions.push('<a tabindex="0" class="btn btn-info btn-xs" role="button" data-container="body" data-placement="bottom" data-toggle="popover" data-html="true" data-trigger="hover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');*/
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
    // function addStaff(unitId) {
    //     $.modal.open("从业人员", $.common.setURL("/control/staff/getStaff/" + unitId));
    // }
    /*function addStaff(unitId) {
        $.modal.open("添加从业人员", $.common.setURL("/control/staff/add/" + unitId));
    }*/
    function getStaffList() {
        $.modal.openTab("从业人员", $.common.setURL("/control/staff"));
    }
</script>
</body>
<!-- 导入区域 -->
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i>
                    下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>
</html>
